<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <style>
        .grid-content {
            border-radius: 4px;
            min-height: 40px;
        }
    </style>
</head>
<body class="hold-transition">
<div id="app">
    <div class="content-header">
        <h1>会员管理<small>会员统计</small></h1>
        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>会员管理</el-breadcrumb-item>
            <el-breadcrumb-item>会员统计</el-breadcrumb-item>
        </el-breadcrumb>
    </div>

    <div class="app-container">
        <div class="box" style="height: 200px">
            <div class="excelTitle">
                会员数据统计
            </div>
            <div class="excelTime">日期：{{reportData.reportDate}}</div>
            <table class="exceTable" cellspacing="0" cellpadding="0">
                <tr>
                    <td colspan="4" class="headBody">会员统计</td>
                </tr>
                <tr>
                    <td width='20%' class="tabletrBg">本月预约会员数量</td>
                    <td width='30%'>{{reportData.thisMonthOrderNumber}}</td>
                    <td width='20%' class="tabletrBg">会员总数</td>
                    <td width='30%'>{{reportData.totalMember}}</td>
                </tr>

            </table>

        </div>
    </div>
    <div class="app-container">
        <div class="box">
            <div class="filter-container">
                <el-input placeholder="档案编号/姓名/预约日期" v-model="pagination.queryString" style="width: 200px;"
                          class="filter-item"></el-input>
                <el-button @click="pagination.currentPage=1;findPage()" class="dalfBut">查询</el-button>

                <table class="exceTable" cellspacing="0" cellpadding="0" bgcolor="aqua" style="margin-top: 10px;">
                    <tr>
                        <td colspan="4" class="headBody">预约会员详情</td>
                    </tr>
                </table>
            </div>

            <!--查询后显示的效果-->
            <el-table size="small" current-row-key="id" :data="dataList" stripe highlight-current-row>
                <el-table-column type="index" align="center" label="序号"></el-table-column>

                <el-table-column prop="fileNumber" label="档案编号" align="center"></el-table-column>

                <el-table-column prop="name" label="姓名" align="center"></el-table-column>
                <el-table-column label="性别" align="center">
                    <template slot-scope="scope">
                        <span>{{ scope.row.sex == '1' ? '男' : '女'}}</span>
                    </template>
                </el-table-column>

                <el-table-column prop="phoneNumber" label="电话号码" align="center"></el-table-column>


                <el-table-column prop="orderDate" label="预约日期" align="center" :formatter="formDate"></el-table-column>
                <el-table-column prop="orderType" label="预约类型" align="center"></el-table-column>
                <el-table-column prop="orderStatus" label="预约状态" align="center"></el-table-column>
                <el-table-column prop="address" label="预约地址" align="center"></el-table-column>
            </el-table>


            <div class="pagination-container">
                <el-pagination
                        class="pagiantion"
                        @current-change="handleCurrentChange"
                        :current-page="pagination.currentPage"
                        :page-size="pagination.pageSize"
                        :total="pagination.total"
                        layout="total, prev, pager, next, jumper">
                </el-pagination>
            </div>

        </div>
    </div>
</div>


<!-- 引入组件库 -->
<script src="../js/vue.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<script>
    var vue = new Vue({
        el: '#app',
        data: {
            reportData: {
                reportDate: null, //日期
                thisMonthOrderNumber: 0,  //本月预约数量
                totalMember: 0,  //会员总数
            },
            pagination: {//分页相关属性
                currentPage: 1,
                pageSize: 8,
                total: 100,
                queryString: null,
            },
            dataList: [],//列表数据
            formData: {},//表单数据
        },

        created() {
            //发送Ajax请求获取当月的会员数量，总会员数量
            axios.get("/report/findCount.do").then((res)=>{
                this.reportData = res.data.data;
            }).finally(()=>{
                //钩子函数每次加载页面自动分页查询下面的表单数据
                this.findPage();
            });
        },

        methods: {

            //分页查询   使用了钩子函数  页面加载完毕后自动执行一次
            findPage() {
                var param = {
                    currentPage:this.pagination.currentPage,
                    pageSize: this.pagination.pageSize,
                    queryString: this.pagination.queryString
                };
                //发送ajax请求
                axios.post("/report/findPage.do",param).then((res)=>{
                    //分页查询成功
                    this.dataList=res.data.rows;
                    this.pagination.total=res.data.total;
                });

            },
            //切换页码  参数 currentPage 是切换后的页码
            handleCurrentChange(currentPage) {
                //重新设置页码，将原有的页改成新的页码  显示条数这些不用变
                this.pagination.currentPage = currentPage;
                //调用findPage方法，再次项后端发送数据
                this.findPage();
            },
        }
    })


</script>

</body>
</html>